#include "client.h"

Client::Client()
{
	QVBoxLayout *vLay = new QVBoxLayout();
	text = new QTextEdit();
	vLay->addWidget(text);
	setLayout(vLay);
	socket = new QTcpSocket();
	connect(socket, SIGNAL(readyRead()), SLOT(readMessage()));
	connect(socket, SIGNAL(disconnected()), SLOT(disSlot()));
	socket->connectToHost("LocalHost", 6789);
}

void Client::readMessage()
{
	QDataStream in(socket);
	QString m;
	in>>m;
	qDebug()<<m;
}
void Client::disSlot()
{
	qDebug()<<"disconnect";
}
